package com.six.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.six.pojo.Attendance;
import com.six.pojo.dto.AttendanceDto;
import com.six.pojo.vo.AttendanceVo;
import com.six.result.Result;
import com.six.result.ResultUtils;
import com.six.service.AttendanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@Slf4j
@RequestMapping("/attendance")
@Api(tags = "y出勤记录")
@CrossOrigin
@ResponseBody
public class AttendanceController {

    @Autowired
    private AttendanceService attendanceService;

    @PostMapping("/list")
    @ApiOperation(value = "查询所有出勤记录")
    public Result findAll(@RequestBody AttendanceVo attendanceVo){
        Page page = new Page(attendanceVo.getPage(),attendanceVo.getLimit());
        Page<AttendanceDto> allAttendance = attendanceService.findAllAttendance(page, attendanceVo);
        return ResultUtils.buildSuccess(allAttendance.getTotal(),allAttendance.getRecords());
    }

    // TODO excel导入出勤记录，该表存在admin_id


}
